CC = g++
DEBUG = -g
CFLAGS = $(DEBUG) -pthread -Wall
LDFLAGS =
BUILD_DIR = ../bin
LIB_PREFIX = /usr/
INCLUDE = -I$(LIB_PREFIX)/include
LIBPATH = $(INCLUDE) -L$(LIB_PREFIX)/lib
LIBS = $(LIBPATH) -lgflags -lglog -lCLHEP -ltcmalloc -lprotobuf
TEST_LIBS = $(LIBS) -lgtest -lgtest_main

SRCS_COMMON = quirksim.h quirksim.cc
SRCS = $(SRCS_COMMON) quirksim_main.cc quirksim_test.cc
OBJS = $(SRCS:.CPP=.O)

all : quirksim quirksim_test

quirksim : main.cc $(SRCS_COMMON)
	$(CC) $(LDFLAGS) $(LIBS)  $^ -o $(BUILD_DIR)/$@

quirksim_test : quirksim_test.cc $(SRCS_COMMON)
	$(CC) $(LDFLAGS) $(TEST_LIBS) $^ -o $(BUILD_DIR)/$@

.cpp.o:
	$(CC) $(CFLAGS) $< -o $(BUILD_DIR)/$@
